﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Leadtools.Codecs;
using Leadtools;
using System.Runtime.InteropServices;

namespace MINERP.NewPB.Presenter
{
    /// <summary>
    /// 常用帮助方法
    /// </summary>
    class CommonUtil
    {
        public static RasterImage GetStampPic(string picPath)
        {
            RasterCodecs.Startup();
            RasterCodecs codecs = new RasterCodecs();
            RasterImage image1 = null;
            CodecsThumbnailOptions options = CodecsThumbnailOptions.Default;
            //options.LoadStamp = true;
            //options.Resample = true;
            //options.MaintainAspectRatio = false;
            try
            {
                //image1 = codecs.ReadThumbnail(picPath, options, 1);
                image1 = codecs.Load(picPath);
            }
            catch
            {
                options.LoadStamp = false;
                image1 = codecs.ReadThumbnail(picPath, options, 1);
            }
            codecs.Dispose();
            RasterCodecs.Shutdown();

            return image1;
        }
    }
}
